package me.zhengjie.modules.dcompany.domain;

import me.zhengjie.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;

import java.io.Serializable;

/**
* @author TianI
* @date 2022-01-23
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("dependent_company")
public class DependentCompany extends CommonModel<DependentCompany> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "分公司主键id")
    @TableId(type= IdType.INPUT)
    private Long dcompanyId;

    @ApiModelProperty(value = "关联总公司主键id")
    private Long companyId;

    @ApiModelProperty(value = "分公司名称")
    private String dcompanyName;

    @ApiModelProperty(value = "分公司地址")
    private String dcompanyAddress;

    @ApiModelProperty(value = "分公司属地编码")
    private String dcompanyCode;

    public void copyFrom(DependentCompany source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
